package com.demo.idempotent.services;

import com.demo.idempotent.annotations.Idempotent;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class TestServiceImpl implements TestService {
    @Override
    @Cacheable
    public String normal(String id) {
        return System.currentTimeMillis() + "";
    }

    @Idempotent("hahah")
    @Override
    public String idemponment(String id) {
        try {
            Thread.sleep(5000);
        } catch (Exception e) {

        }
        return System.currentTimeMillis() + "";
    }
}
